package com.henry.base.java8.lambda;

public class TestLambda {
    public static void main(String[] args) {
        MathOperation add=(a,b)->a+b;
        MathOperation sub=(a,b)->a-b;
        MathOperation mul=(a,b)->a*b;
        MathOperation div=(a,b)->a/b;
        TestLambda testLambda = new TestLambda();
        System.out.println(testLambda.operate(10,5,add));
        System.out.println(testLambda.operate(10,5,sub));
        System.out.println(testLambda.operate(10,5,mul));
        System.out.println(testLambda.operate(10,5,div));
    }

    private int operate(int a, int b, MathOperation operation) {
        return operation.operation(a, b);
    }
}
